Create directory more than one level deep, such as C:\Windows\MyApp\Files. Returns True if succeede
Create directory more than one level deep, such as C:\Windows\MyApp\Files. Returns True if succeeded or False if failed creating directory.
Rate Create directory more than one level deep, such as C:\Windows\MyApp\Files. Returns True if succeede
(2(2 Vote))
On Error Resume Next
Dim bytMax As Byte
Dim bytNdx As Byte
Dim strDirLevel As String
If Right(strDir, 1) <> "\" Then
strDir = strDir & "\"
End If
bytMax = Len(strDir)
For bytNdx = 4 To bytMax
If (Mid(strDir, bytNdx, 1) = "\") Then
strDirLevel = Left(strDir, bytNdx - 1)
If Dir(strDirLevel, vbDirectory) = "" Then
MkDir strDirLevel
End If
End If
Next
If Dir(strDir, vbDirectory) <> "" Then
CreateDir = True ' Succeeded creating directory
Else
CreateDir = False ' Failed creating directory
End If
End Function
Create directory more than one level deep, such as C:\Windows\MyApp\Files. Returns True if succeede Comments
No comments yet — be the first to post one!
Post a Comment